﻿using Microsoft.AspNetCore.Mvc;

namespace PageOffice6_Net_Core.Controllers.ExcelAdjustRC
{
    public class ExcelAdjustRCController : Controller
    {
        public IActionResult Excel()
        {
            PageOfficeNetCore.PageOfficeCtrl poCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request);

            PageOfficeNetCore.Excel.WorkbookWriter wb = new PageOfficeNetCore.Excel.WorkbookWriter();
            PageOfficeNetCore.Excel.SheetWriter sheet1 = wb.OpenSheet("Sheet1");
            //设置当工作表只读时，是否允许用户手动调整行列。
            sheet1.AllowAdjustRC = true;

            poCtrl.SetWriter(wb);
            //打开Excel文档
            poCtrl.WebOpen("doc/test.xls", PageOfficeNetCore.OpenModeType.xlsReadOnly, "tom");
            ViewBag.poCtrl = poCtrl.GetHtml();
            return View();
        }
    }
}